﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;
using System.Windows;

namespace TfsBacklogMgr.Main
{

    public class BoolToVisibilityConverter : IValueConverter
    {
        // Do the conversion from bool to visibility
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Visibility vis = Visibility.Visible;
            if (value != null)
            {
                bool v = (bool)value;
                if (v == false)
                    vis = Visibility.Collapsed;
            }
            return vis;
        }

        // Do the conversion from visibility to bool
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }


    public class BoolToInvisibilityConverter : IValueConverter
    {
        // Do the conversion from bool to visibility
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Visibility vis = Visibility.Visible;
            if (value != null)
            {
                bool v = (bool)value;
                if (v == true)
                    vis = Visibility.Collapsed;
            }
            return vis;
        }

        // Do the conversion from visibility to bool
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }

}
